home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software 2000
/
Software 2000 Volume 1 (Disc 1 of 2).iso
/
utilities
/
u263.dms
/
u263.adf
/
UEDIT
/
CONFIG!R
< prev
next >
Wrap
Text File
|
1978-01-07
|
9KB
|
311 lines
-----------------------------------------------------------------------------
| Config!R |
| Copyright (C) 1986-92 Rick Stiles. All rights reserved. |
-----------------------------------------------------------------------------
*************************************
N-variables used:
n0-n1scratch numbers
n26 used by rexx
n27 action/result
n28 rexx flag
n29 rexx return code
Buffers used:
buf50 & buf51 scratch buffers
buf36 REXXCOMM buf
buf49 search buf
buf61 rexx in buf
buf62 rexx out buf
*************************************
<defines:
define(N_0,n0)
define(N_1,n1)
define(RX_VAR,n26)
define(ACT_RESULT,n27)
define(FLAG_BITS,n28)
define(RTN_CODE,n29)
define(NSTACK_99,n99) .. note n99 not really used
define(B_0,buf50)
define(B_1,buf51)
define(BSTACK_99,buf99) .. note buf99 not really used
define(REXX_COMM_BUF,buf36)
define(SEARCH_STR,buf49)
define(REXX_IN_BUF,buf61)
define(REXX_OUT_BUF,buf62)
>
======= AREXX CMDS ======
Major modifications to this file by Kerry Zimmerman [71470,1340] 4/14/89
o Changed output buffer to 62, input buffer to 61 to avoid conflict with
Eric Kennedy's VI extensions.
o altctl-0 now asks for a command name and a list of macronums.
It adds these to the end of file U:REXXCOMM. This file is a database
of macros understood by the new rexx autotraffic handler.
Edit Rexx output buffer 62
<altCtl-1:
equateLoc(REXX_OUT_BUF,sPage,sFile)
editBuf(REXX_OUT_BUF) >
Edit Rexx input buffer 61
<altCtl-2:
equateLoc(REXX_IN_BUF,sPage,sFile)
editBuf(REXX_IN_BUF) >
Send output buffer 62 to Rexx
<altCtl-3:
equateNum(FLAG_BITS,0) .. 0 flag means send msg, not reply
rexxOut(REXX_OUT_BUF,all,0,FLAG_BITS,RTN_CODE) .. 0 ActionResult means default to RXCOMM
runKey(virtual-s) >
Fetch Rexx input into buffer 61
<altCtl-4:
if (rexxIn(REXX_IN_BUF,sFile,ACT_RESULT,FLAG_BITS,RTN_CODE)) {
..if (eqNum(FLAG_BITS,0)) { .. if Msg
equateLoc(REXX_IN_BUF,sPage,sFile)
editBuf(REXX_IN_BUF)
..}
}
runKey(virtual-r) >
Send hilite region to Rexx.
<altCtl-5:
equateNum(FLAG_BITS,0) .. 0 means msg, not reply
rexxOut(curFile,hilite,0,FLAG_BITS,RTN_CODE) .. 0 means default to Action = RXCOMM
runKey(virtual-s) >
Fetch Rexx input at cursor
<altCtl-6:
rexxIn(curFile,atCursor,ACT_RESULT,FLAG_BITS,RTN_CODE)
runKey(virtual-r) >
Send an OK reply to Rexx (NOTE: Amiga-ESC abort sends Failed reply.)
<altCtl-7:
equateNum(FLAG_BITS,1) .. 1 means reply, not msg
rexxOut(" ",all,0,FLAG_BITS,RTN_CODE) .. 0 is OKAY result
runKey(virtual-s) >
Send an OK reply to Rexx along with text in hilite region
<altCtl-8:
equateNum(FLAG_BITS,1)
rexxOut(curFile,hilite,0,FLAG_BITS,RTN_CODE) ..text NOT sent, if not RXFB_RESULT msg
runKey(virtual-s) >
Make an x.rexx program with commands to send to Uedit.
<altCtl-0:
freebuf(REXX_COMM_BUF)
if (!loadfile("REXXCOMM")) loadfile("S:REXXCOMM")
movecursor(curFile,eFile)
putmsg("Enter new command's name")
freebuf(B_0)
inputString(B_0)
insertRgn(curFile,atCursor,B_0,all)
insertRgn(curFile,atCursor," |
",all)
movecursor(curFile,sChar)
movecursor(curFile,sChar)
updateDisplay
while (nothing) {
putMsg("Give desired inputs. Amiga-ESC when done. F2 to save.")
getKeyVal(macroNum,inputChar)
toWord(curFile,macroNum)
insertChar(curFile,"+")
toWord(curFile,inputChar)
insertChar(curFile," ")
updateDisplay
fileSize(curFile,N_0) .. force pack, avoid mem-abort
}
>
<virtual-t: .. swap this into rexxKey cmd when autoTraffic is used.
if (rexxIn(REXX_IN_BUF,eFile,ACT_RESULT,FLAG_BITS,RTN_CODE)) { .. if fetched something
..runKey(virtual-r) .. show flags - slower if use this line
if (eqNum(FLAG_BITS,0)) { .. if recvd a Msg, not a Reply
equateNum(RX_VAR,0)
push(NSTACK_99,searchCaps) .. (RS mod)
equateNum(searchCaps,0) .. turn off case sensitivity (RS mod)
runkey(virtual-y)
pop(RTN_CODE,searchCaps) .. restore orig case sensitivity (RS mod)
freeBuf(REXX_IN_BUF)
if(not eqNum(RX_VAR,0)) return .. comand already sent a reply
if(eqLoc(curFile,sInvert,eInvert)) goto label(50)
rexxOut(curFile,Invert,0,1,RTN_CODE) .. search uses this as an example
return
label(50) rexxOut(" ",all,0,1,RTN_CODE)
}
}
>
handle named macro messages
<virtual-y:
.. if REXX_COMM_BUF doesn't contain the named commands yet
.. read it in
moveCursor(REXX_COMM_BUF,sfile)
freeBuf(B_0)
insertRgn(B_0,atCursor,"REXXCOMM",all)
setSearch(B_0)
if(not search(REXX_COMM_BUF,sHilite,eHilite,1)) {
freeBuf(REXX_COMM_BUF)
if(!insertFile(REXX_COMM_BUF,sfile,"REXXCOMM")
& !insertFile(REXX_COMM_BUF,sfile,"S:REXXCOMM")) {
putmsg("file REXXCOMM not found")
returnFalse
}
}
.. extract 1st word of REXX_IN_BUF which is the command
moveCursor(REXX_IN_BUF,sfile)
equateLoc(REXX_IN_BUF,sHilite,atCursor)
moveCursor(REXX_IN_BUF,eWord)
equateLoc(REXX_IN_BUF,eHilite,atCursor)
freebuf(B_0)
insertRgn(B_0,sFile,REXX_IN_BUF,Hilite) ..save command
clearRgn(REXX_IN_BUF,Hilite) ..erase command leaving any args
while(is(REXX_IN_BUF,whiteSpace))
clearChar(REXX_IN_BUF)
setSearch(B_0)
.. search for this command in list of commands in REXX_COMM_BUF
moveCursor(REXX_COMM_BUF,sfile)
moveCursor(REXX_COMM_BUF,eLine) .. start search after 1st line
if(not search(REXX_COMM_BUF,sHilite,eHilite,1)) {
freeBuf(B_1)
insertRgn(B_1,efile,"REXX command NOT found: ",all)
insertRgn(B_1,efile,B_0,all)
returnFalse
}
.. move to the first macronum
moveCursor(REXX_COMM_BUF,eHilite)
.. process each macronum+inputchar pair until "|" found
label(10)
while(is(REXX_COMM_BUF,whitespace))
moveCursor(REXX_COMM_BUF,echar)
.. return if end of commands
if(is(REXX_COMM_BUF,"|") | is(REXX_COMM_BUF,eFile)) returnTrue
.. convert xx+yy to macronum-xx, inputchar-yy
equateNum(macroNum,0)
equateNum(inputChar,0)
if(is(REXX_COMM_BUF,digit)) {
toNumber(macroNum,REXX_COMM_BUF)
while(is(REXX_COMM_BUF,digit))
moveCursor(REXX_COMM_BUF,echar)
if(is(REXX_COMM_BUF,"+")){
moveCursor(REXX_COMM_BUF,echar)
if(is(REXX_COMM_BUF,digit)){
toNumber(inputChar,REXX_COMM_BUF)
while(is(REXX_COMM_BUF,digit))
moveCursor(REXX_COMM_BUF,echar)
}
}
}
.. run valid macroNum, or type valid inputChar
if(inUse(macroNum)) runKey(macroNum)
else if(gtNum(inputChar,0)) TypeChar(inputChar)
else return
goto label(10) >
Show numbers for a received Arexx msg or reply
<virtual-r:
if (not eqNum(RTN_CODE,0)) runKey(virtual-m) .. rexxIn() failed
else { .. rexxIn() succeeded
if (eqNum(FLAG_BITS,0)) { .. MSG: show action & modifiers
and(RX_VAR,ACT_RESULT,0X0F000000) .. get ACTION code
and(N_1,ACT_RESULT,0X000F0000) .. get MODIFIER
if(gtNum(N_1,0)) div(N_1,N_1,0x10000)
freeBuf(B_1)
insertRgn(B_1,atCursor,"Msg fetched: Action = ",all)
toWord(B_1,RX_VAR)
insertRgn(B_1,atCursor," Modifier = ",all)
toWord(B_1,N_1)
..insertRgn(B_1,atCursor," -- press return",all)
putMsg(B_1)
} else { .. REPLY:
if (eqNum(ACT_RESULT,0)) putMsg("Reply fetched. Result OKAY")
else {
freeBuf(B_1)
insertRgn(B_1,atCursor,
"Reply received: Result = ERROR ",all)
toWord(B_1,ACT_RESULT)
..insertRgn(B_1,atCursor," -- press return",all)
putMsg(B_1)
}
}
}
..getkey(N_0)
>
Show numbers for a sent ARexx msg or reply
<virtual-s:
if (not eqNum(RTN_CODE,0)) runKey(virtual-m) .. rexxOut() failed
else {
if (eqNum(FLAG_BITS,0)) putMsg("Msg sent")
else putMsg("Reply sent")
}
>
Show returncode error msgs
<virtual-m:
switch(RTN_CODE) {
case(-1) { putMsg("ARexx not up") }
case(-2) { putMsg("No memory or no text") }
case(-3) { putMsg("Msg/reply > 65535 bytes") }
case(-4) { putMsg("Nothing to fetch or reply to") }
case(-5) { putMsg("Fetch reply before sending this msg/reply") }
}
returnFalse .. so virtual-r/-s above will return False
>
====================================================================
Some useful functions for the arexx macros
The 'ask' macro. Usage: ask 'Do you want to continue?'
ask a question and return true or false
<virtual-i:
equateNum(RX_VAR,1)
if(askYesNo(REXX_IN_BUF))
rexxOut("YES",all,0,1,RTN_CODE)
else
rexxOut("NO",all,0,1,RTN_CODE)
>
the 'text' macro. Usage: text 'this will be inserted'
insert text at cursor
<virtual-h: insertRgn(curFile,atCursor,REXX_IN_BUF,all)
updatedisplay>
the 'loadfile' macro. Usage: loadfile 'sys:myfile'
edit given file
<virtual-j: loadfile(REXX_IN_BUF)>
the 'gotoline' macro Usage: gotoline 100
goto line
<virtual-n: toNumber(N_0,REXX_IN_BUF) lineToLoc(curFile,atCursor,N_0) >
the 'searchfor' macro Usage: searchfor pattern
search for a given string
<virtual-o:
push(BSTACK_99,REXX_IN_BUF)
pop(BSTACK_99,SEARCH_STR)
setsearch(SEARCH_STR)
runkey(normal-f9) >
The 'message' macro Usage: message 'my message'
issue a message
<virtual-p: putmsg(REXX_IN_BUF) >
<defines: >